package com.mgfireworks.mgplatform.mgadmin.sys;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.multipart.MultipartFile;

import cn.hn.java.summer.exception.BusinessException;
import cn.hn.java.summer.mvc.Result;

@Controller
@RequestMapping("/sys/file")
public class FileController extends BaseController{
	
	@Autowired
	FileService fileService;

	/**
	 * 上传文件
	 * @param file
	 * @throws BusinessException
	 */
	@PostMapping("/uploadProductImg")
	public Result uploadImg(MultipartFile file) throws BusinessException{
		String imgPath=fileService.uploadProductImg(file);
		return new Result(true,imgPath);
	}
	
}
